<template>
    <div>

     <van-row>
            <Hearders />
            <van-col span="4">
                <Left />
            </van-col>

            <van-col span="4">
                <h3>请选择为哪位用户添加</h3>
                    {{uid}}
                    <select name="" id="" v-model="uid">
                        <option :value="i.id" v-for="i in userlist">{{i.name}}</option>
                    </select>
                    
                
            </van-col>

            <van-col span="16">
                <Transfers @value='shou' />
                <van-button @click="add">添加权限</van-button>
            </van-col>


            </van-row>

        

    
    </div>
</template>

<script>
import Hearders from '../comm/hearders'
import Left from '../comm/left.vue'
import Transfers from '../comm/transfers.vue'
import axios from '../../http/axios'
    export default {
  components: { Hearders ,Left,Transfers},
    data() {
        return {
            reslist:[],
            userlist:[],
            uid:'',
            value:[]
        }
    },
    methods: {
        //获取用户id
        getuser(){
            axios('/users/getuser/','get').then(res=>{
                    this.userlist = res.list
            })
        },                                                                                                                 
        //添加权限  {userid:this.uid,'values':this.value}
        add(){
            let data = new FormData()
            data.append("userid",this.uid)
            data.append("values",this.value)
            axios('/users/getuser/','post',data).then(res=>{

            })
        },
        //接收穿梭框的值
        shou(value){
            
            this.value = value
        }
        
        
    
    },
    mounted() {
        this.getuser()
        
        
    },
    }
</script>

<style scoped>

</style>